<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
		<meta charset="UTF-8">
		<title>bui-ssm快速开发框架</title>
		<head th:include="source::header"></head>
</head>
<body>
		<div class="form_main_wrap">
			<div class="form_condition">
				<table class="form_table">
					<tr>
						<td class="label label100">[(${Lang.user_orgName})]</td>
						<td><input id="orgTree" name="orgTree" class="form_input form_input50" type="text"/></td>
					</tr>
					<tr>
						<td class="label label100">[(${Lang.user_name_account})]</td>
						<td><input id="nameAccount" name="nameAccount" class="form_input form_input50" type="text"/></td>
					</tr>
					<tr>
						<td colspan="2" style="padding-left:150px">
							<button class="k_icon_fff" id="search_btn">
								<i class="fa fa-search"></i>
								[(${Lang.common_search})]
							</button>
						</td>
					</tr>
				</table>			
			</div>
			<div class="form_grid">
				<table id="datagrid"></table>
			</div>
		</div>
</div>
<script type="application/javascript" th:inline="javascript">
		var curdObj,
			$win,
			saveUserRoleFn,
			height = 322,
			gridOpts = [(${dataGridJson})];//获取datagrid配置json
			var title = "[(${Lang.user_windowTitle})]";//国际化语言
			gridOpts.title = title;
		$(function () {
			var dg = $("#datagrid");			
			gridOpts.showBtnText = false;
			gridOpts.onRowRender = function (data, rowIdx){
				if(data.id === "0"){
					var tds = this.children();
					tds.first().children().addClass("k_datagrid_chkbox_disabled");
				}				
			};
			curdObj = new $B.CURD(dg, gridOpts);
			//查询条件
			var orgJson = [(${orgJson})];
			var opts = {
			        data: orgJson,//数据 参考树数据
		            default: {
		                "id": '',
		                "text": "[(${Lang.common_all})]"
		            },
		            placeholder: "[(${Lang.common_pleaseSelected})]", //默认选择项目
		            checkox:false,
		            mutilChecked:false,
		            url: $B.getHttpHost(ctxPath) + "org/query",	          
		            checkfather: true, // 单选的时候，是否可以选择父节点
		            readonly: true, //不可以编辑                
		            plainStyle: true, //\"true\" 为简单无图标样式
		            textField: 'text', //菜单名称字段，默认为text
		            idField: 'id', //菜单id字段,默认为id
		        };
			var $tree = $("#orgTree");
			var box = new $B.Combox($tree, opts);
			$("#search_btn").click(function(){
				var prs = {
					orgId : box.val(),
					nameAccount : $("#nameAccount").val()
				};
				curdObj.reload(prs);
			});
		});
		//打开form.html
		function _openForm(prs,isUpdate,rowData){
			var opts = {
				dataType:'html',
				title:title,
				width:700,
				height:height
			};
			if(isUpdate && rowData){
				opts.rowData = rowData;
			}
			curdObj.window(opts,isUpdate);
		};
		/******工具栏事件集合******/
		window.toolMethods = {
			addFn:function(prs){
				_openForm(prs);
			},
			updateFn:function(prs){
				_openForm(prs,true);
			},
			deleteFn:function(prs){
				curdObj.delChecked();
			},
			lineUpdateFn:function(prs){
				_openForm(prs,true,prs);
			},
			lineDeleteFn:function(prs){
				curdObj.deleteData([prs.id]);
			},
			pwdFn:function(prs){
				$win = $B.window({
					title:'[(${Lang.user_resetpwd})]'+'['+prs.userName+']',
					width:600,
					height:250,
					dataType:'html',
					content:$B.getHttpHost(ctxPath)+"user/page/pwd?userId="+prs.id,
					toolbar:[
						{
							text: '[(${Lang.common_submit})]',
							iconCls:' fa-check',
					        click: function(){					        	
					        	resetPwdFn($win,this);
					        }
						},{
							 text: '[(${Lang.common_cancel})]',
							 iconCls:'fa-reply-all',
						     click: function(){
						    	 $win.close();
						     }
						}
					]
				});
			},
			roleUpdateFn:function(prs){				
				$win = $B.window({
					title:'[(${Lang.user_roles})]'+'['+prs.userName+']',
					width:800,
					height:450,
					content:$B.getHttpHost(ctxPath)+"user/page/role?userId="+prs.id,
					toolbar:[
						{
							text: '[(${Lang.common_submit})]',
							iconCls:' fa-check',
					        click: function(){					        	
					        	saveUserRoleFn($win,this);
					        }
						},{
							 text: '[(${Lang.common_cancel})]',
							 iconCls:'fa-reply-all',
						     click: function(){
						    	 $win.close();
						     }
						}
					]
				});
			}
		};
		
		function formatOrg(cData,rData){
			return rData.extFeildsMap.orgName;
		}
		
		function formatStatus(cData,rData){
			if(cData === 1){
				return '[(${Lang.common_enabel})]';
			}
			return '[(${Lang.common_disabel})]';
		} 
		
		
</script>
</body>
</html>
